/**
 *
 */
package com.caiyi.financial.nirvana.sms.cmpp.message.body;

import com.caiyi.financial.nirvana.sms.cmpp.message.CMPP3Body;
import io.netty.buffer.ByteBuf;

public class CMPP3SubmitResp extends CMPP3Body {

    private long messageId;
    private int result;


    @Override
    public int encode(ByteBuf buffer) {
        int length = 0;
        buffer.writeLong(this.messageId);
        length += 8;
        buffer.writeInt(this.result);
        length += 4;
        return length;
    }


    @Override
    public CMPP3Body decode(ByteBuf buffer) {
        this.messageId = buffer.readLong();

        this.result = buffer.readInt();
        return this;
    }

    public void setMessageId(long messageId) {
        this.messageId = messageId;
    }


    public void setResult(byte result) {
        this.result = result;
    }

    /**
     * @return the messageId
     */
    public long getMessageId() {
        return messageId;
    }

    /**
     * @return the result
     */
    public int getResult() {
        return result;
    }

    @Override
    public String toString() {
        return "CMPPSubmit [messageId=" + messageId + ", result=" + result + "]";
    }

}
